package model;

public class Database {
	private static Database instance = new Database();

	/**
	 * Get the single instance of Database.
	 * 
	 * @return the single instance of Database
	 */
	public static Database getInstance() {
		return instance;
	}
	
	private ClassMapper classMapper;
	
	private Database() {
		classMapper = new ClassMapper();
		
		try {
			
			/*
			 * Note: Read class folder and update class mapper. 
			 * Add items only.  
			 */
			
			classMapper.addItem(new Item("Apples", "This is a class!"));
			classMapper.addItem(new Item("Oranges", "7"));
			classMapper.addItem(new Item("Pomegranates", "77"));
		} catch (ClassMapException e) {
			// should not happen
			throw new IllegalStateException("can't happen", e);
		}
	}
	
	/**
	 * Get the Inventory object.
	 * 
	 * @return the Inventory object
	 */
	public ClassMapper getInventory() {
		return classMapper;
	}
}
